package com.unytech.project.entity.security;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Index;

import com.unytech.project.entity.BaseEntity;
import com.unytech.project.entity.system.User;

@Entity
@Table(name="T_LOGINECORD")
@GenericGenerator(name="uuidpk",strategy="uuid")
public class LoginRecord extends BaseEntity {
	@Id @GeneratedValue(generator="uuidpk")
	@Column(length=32,nullable=false)
	@Index(name="loginrecordid_index")
	private String loginrecid;
	
	@Temporal(TemporalType.TIMESTAMP)
	private Date logintime;
	
	@Temporal(TemporalType.TIMESTAMP)
	private Date logouttime;
	
	/** 客户端IP */
	@Column(length=64,nullable=false)
	private String clientip;
	
//	private String ipport;
//	private String clientaddress;
	
	/** 客户端MAC */
//	@Column(length=64)
//	private String clientMAC;
	
//	@Column(length=30)
//	private String browser;
	
//	@Column(length=10)
	private String language;
	
	@Column(length=50)
	private String userAgent;
	
	@ManyToOne(cascade={CascadeType.REFRESH}, optional=true)
	@JoinColumn(name="loginuser_id") 
	private User loginuser;
	
	
}
